#ifndef CONTOURITEM_H
#define CONTOURITEM_H

#include <QGraphicsItem>

#include <QtGui/QColor>
#include <QGraphicsItem>
#include "geometrydata.h"
#include <QVector>
#include <QStyleOptionGraphicsItem>
#include <QPen>
#include <QPainter>
#include "datastructures.h"

class ContourItem : public QGraphicsItem
{
public:
    ContourItem(Contour *ctr);

    QRectF boundingRect() const;
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget);
    void select() {select_ = !select_;}

    void updateParams();
    Contour * ctr() { return contour; }

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

private:

    bool select_;

    QPen pen;
    QBrush brush_empty;
    QBrush brush_colored;

    Contour *contour;
    QPolygonF polygon;
};

#endif // CONTOURITEM_H
